<template>
  <div class="boxs" style="background-color: #fff;">
    <a-form-model ref="privacyagreementModel" layout="vertical" 
    :labelCol="{span: 2}" :wrapperCol="{span: 21}">
        <a-form-model-item label="标题" :rules ="[
          {required: true, message: '请输入标题名称', trigger: 'blur'}
        ]">
          <a-input v-model="privacy_agreement_title"  placeholder="请输入标题名称" />
        </a-form-model-item>
        <a-form-model-item label="内容"  :rules ="[
          {required: true, message: '请输入内容', trigger: 'blur'}
        ]">
          <quills :contents.sync="privacy_agreement"></quills>
        </a-form-model-item>
        <a-form-model-item  :wrapper-col="{ span: 21, offset:2 }">
          <a-button type="primary" style="width: 100%;" @click="whites">修改</a-button>
        </a-form-model-item>
    </a-form-model>
  </div>
</template>

<script>
import { getPrivacyAgreementInfo,writePrivacyAgreementInfo } from '@/api/brand.js'
export default {
  name: 'privacyagreement',
  
  data() {
      return {
        privacy_agreement:"",
        privacy_agreement_title:"",
      }
  },
  created(){
    this.getPrivacyAgreementInfo()
  },
  methods:{
    getPrivacyAgreementInfo(){
      getPrivacyAgreementInfo({
        brand_id: process.env.VUE_APP_BRAND_ID}).then(res=>{
        this.privacy_agreement=res.data.privacy_agreement
        this.privacy_agreement_title=res.data.privacy_agreement_title
      })
    },
    whites(){
      writePrivacyAgreementInfo({
        brand_id: process.env.VUE_APP_BRAND_ID,
        privacy_agreement:this.privacy_agreement,
        privacy_agreement_title:this.privacy_agreement_title,
      }).then(res => {
        this.$message.success("操作成功");
      })
    },
  }
}
</script>

<style lang="less" scoped>
.boxs{
  width: 800px;
  padding: 20px 30px;
}

</style>
